
<#
.SYNOPSIS 
Hydration Script for MDTEx

.DESCRIPTION
_TEMPLATE_

.NOTES
Copyright Keith Garner (KeithGa@DeploymentLive.com), All rights reserved.

.LINK
http://MDTEx.CodePlex.com

#>

[CmdletBinding()]
param(
    [switch] $Quiet,
    [parameter(ValueFromRemainingArguments=$true)] $Remaining
)


if (!(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator))
{
	throw "This script should be run with FULL Administrative Privelages!"
}

if ( [Environment]::OSVersion.Version -lt ( [Version]"6.1" ) )
{
	throw "This script will only run on Windows 7 Windows server 2008 R2 or above!"
}

if ( $PSVersionTable -eq $null )
{
	throw "Must have Powershell Version 2.0 or greater"
}

if ( $PSVersionTable.PSVersion -lt [system.version]"3.0" )
{
	throw "Must have Powershell Version 2.0 or greater"
}

if ( -not [environment]::Is64BitOperatingSystem )
{
	write-Warning "Must be running on a 64-bit Operating System"
}

$MDT2013U11 = "6.3.8330.1000"
if ( Test-Path "$env:programFiles\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.PSSnapIn.dll") 
{
    if ( (get-item "$env:programFiles\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.PSSnapIn.dll").VersionInfo.FileVersion -notin $MDT2013U11 )
    {
        Write-Host "Please uninstall MDT"
        throw "Must be running MDT version $MDT2013U11 - MDT 2013 Update 2"
    }

}

if ( Get-VMHost )
{
    Write-Verbose "Hyper-V is installed. "
    if ( -not (get-vmswitch -switchtype external)  )
    {
        throw "you must have at least one switch defined"
    }

    if ( (get-vmHost).VirtualHardDiskPath -isnot [String] )
    {
        throw "you must define the Virutal HArd Disk PAth (Hyper-V Settings)"
    }
}

